<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        *{
            margin: 0;
            padding: 0;
            -webkit-box-sizing: border-box;
            /* 盒子大小默认计算方式为 宽度等于内容的宽度 */
            box-sizing: border-box;
        }
        body{
            --weui-FG-3: rgba(0,0,0,0.1);
            --weui-BRAND:#07c160;
            --weui-BG-3: #f7f7f7;
        }
        .weui-switch{
            -webkit-tap-hightlight-color:transparent;
            /* -webkit Chrome 浏览器内核 老手机*/
            -webkit-appearance: none;
            /* css有世界组织，这个属性还没有被接纳 */
            /* 浏览器对form表单元素样子重置的样式 */
            appearance: none;
            position: relative;
            width: 52px;
            height: 32px;
            border: 2px solid var(--weui-FG-3);
            outline: 0;
            border-radius: 16px;
            -webkit-box-sizing: border-box;
            /* 盒子大小默认计算方式为 宽度等于内容的宽度 */
            box-sizing: border-box;
            -webkit-transition: background-color 0.1s,border 0.1s;
            transition: background-color 0.1s,border 0.1s;
        }
        .weui-switch:checked{
            background-color: var(--weui-BRAND);
            border-color: var(--weui-BRAND);
        }
        .weui-switch::before{
            content: '';
            position: absolute;
            top: 0;left: 0;bottom: 0;right: 0;
            border-radius: 15px;
            background-color: var(--weui-BG-3);
            transition: transform 0.35s ease,-webkit-transform 0.35s ease;
        }
        .weui-switch::after{
            content: '';
            position: absolute;
            top: 0;left: 0;
            width: 28px;
            height: 28px;
            border-radius: 15px;
            background-color: #fff;
            box-shadow: 0 1px 3px rgba(0,0,0,0.4);
            transition: transform 0.35s ease,-webkit-transform 0.35s ease;
        }
        .weui-switch:checked:after{
            -webkit-transform: translateX(20px);
            transform: translateX(20px);
        }
        .weui-switch:checked:before{
            -webkit-transform: scale(0);
            transform: scale(0);
        }
    </style>
</head>
<body>
    <input type="checkbox" class="weui-switch">
</body>
</html>